#ifndef SCENEGRAPHHANDLER_H_
#define SCENEGRAPHHANDLER_H_

#include <osgViewer/Viewer>
#include <osg/Group>
#include <string>

#include <osg/Fog>
#include "Hud.h"
#include "TextBox.h"

using namespace osg;
using namespace std;

class SceneGraphHandler{
public:
	SceneGraphHandler() :
		eyeX(100.0), eyeY(50.0), eyeZ(100.0), 
		centerX(0.0), centerY(0.0), centerZ(0.0),
		hud(0, 800, 0, 600),
		cameraManipulatorText(new TextBox()), 
		legende(new TextBox()),
		legendeBewegen(new TextBox()), 
		legendeSchauen(new TextBox()), 
		legendeManipulator(new TextBox()),
		legendeLicht(new TextBox()), 
		helpText(new TextBox()),
		lightGroup(new Group), skyGroup(new Group),
		lichtMond(new LightSource),
		lichtSonne(new LightSource), lichtSonne2(new LightSource),
		skyBoxTagTransform(new MatrixTransform), skyBoxNachtTransform(new MatrixTransform),
		fog(new Fog), lichtWohnzimmer(new LightSource), lichtKueche(new LightSource),
		lichtSchlafzimmer(new LightSource), lichtFlur(new LightSource),			
		lichtBad(new LightSource), kuhCam(false), muhh(new TextBox())
	{
		erstelleTextBoxen();
	}

	void setEyeX(double eye);
	void setEyeY(double eye);
	void setEyeZ(double eye);

	void setCenterX(double center);
	void setCenterY(double center);
	void setCenterZ(double center);

	double getEyeX();
	double getEyeY();
	double getEyeZ();
	double getCenterX();
	double getCenterY();
	double getCenterZ();

	Hud getHud();
	void addTextBox(TextBox& t);

	osgViewer::Viewer viewer;
	TextBox* cameraManipulatorText;
	TextBox* helpText;
	TextBox* legende;
	TextBox* legendeBewegen;
	TextBox* legendeSchauen;
	TextBox* legendeManipulator;
	TextBox* legendeLicht;
	TextBox* muhh;

	ref_ptr<Group> lightGroup;
	ref_ptr<Group> skyGroup;

	ref_ptr<LightSource> lichtMond;
	ref_ptr<LightSource> lichtSonne;
	ref_ptr<LightSource> lichtSonne2;

	ref_ptr<MatrixTransform>	skyBoxTagTransform;
	ref_ptr<MatrixTransform>	skyBoxNachtTransform;

	ref_ptr<Fog>				fog;

	ref_ptr<LightSource> lichtWohnzimmer;
	ref_ptr<LightSource> lichtKueche;
	ref_ptr<LightSource> lichtSchlafzimmer;
	ref_ptr<LightSource> lichtFlur;
	ref_ptr<LightSource> lichtBad;

	bool kuhCam;

private:

	void setCameraViewMatrixAsLookAt();
	void erstelleTextBoxen();

	double eyeX, eyeY, eyeZ, centerX, centerY, centerZ;
	float x;
	float z;
	Hud hud;
};

#endif
